﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

namespace LINQtoLDAPDemo_ConnectionPoolExample
{
    public class UserMapping : LinqToLdap.Mapping.ClassMap<User>
    {
        public override LinqToLdap.Mapping.IClassMap PerformMapping(string namingContext = null, string objectCategory = null, bool includeObjectCategory = true, IEnumerable<string> objectClasses = null, bool includeObjectClasses = true)
        {
            NamingContext(string.Format("CN=Users,{0}", ConfigurationManager.AppSettings["ldapPartition"]));
            ObjectCategory("user");

            Map(e => e.EmployeeID);
            Map(e => e.LastName).Named("sn");
            Map(e => e.FirstName).Named("givenName");
            Map(e => e.Notes).Named("comment");
            Map(e => e.HomePhone);
            Map(e => e.Title);
            Map(e => e.TitleOfCourtesy).Named("personalTitle");
            Map(e => e.DisplayName);

            DistinguishedName(e => e.DistinguishedName);
            Map(e => e.Manager);

            return this;
        }
    }
}
